#pragma once
#include "coordsys.h"

class CCoordSysRT : public CCoordSys
{
  friend class boost::serialization::access;

public:
  enum CoordSysType {
    kArcArc = 0,

    kCoordSysTypeButt = 1
  };

public:
  CCoordSysRT(void);
  CCoordSysRT(int type, const tstring& name, const tstring& first,
    const tstring& second, const tstring& third);
  virtual ~CCoordSysRT(void);

  static LPCTSTR TypeToString(int type);

public:
  void Reset(void);
  long Build(const CMeasureStation *s, const Halcon::HTuple* mat, double a);
  void GetToolType(int &firstType, int &secondType, int &thirdType);
  void ChangeToolName(int elemType, const tstring& oldName, const tstring& newName);

public:
  const tstring& Name(void) const { return name_; }
  void SetName(const tstring& val) { name_ = val; }

  const tstring& Station(void) const { return station_; }
  void SetStation(const tstring& val) { station_ = val; }

  const tstring& First(void) const { return first_; }
  void SetFirst(const tstring& val) { first_ = val; }

  const tstring& Second(void) const { return second_; }
  void SetSecond(const tstring& val) { second_ = val; }

  const tstring& Third(void) const { return third_; }
  void SetThird(const tstring& val) { third_ = val; }

  int Type(void) const { return type_; }

  int ParamI(void) const { return param_i_; }
  void SetParamI(int val) { param_i_ = val; }

  int ParamJ(void) const { return param_j_; }
  void SetParamJ(int val) { param_j_ = val; } 

  int ParamK(void) const { return param_k_; }
  void SetParamK(int val) { param_k_ = val; }

  long Result(void) const { return result_; }

protected:
  long result_;

private:
  tstring name_;
  tstring station_;
  tstring first_;
  tstring second_;
  tstring third_;
  int     type_;
  int     param_i_;
  int     param_j_;
  int     param_k_;

  template<class Archive>
  void serialize(Archive &ar, const unsigned int)
  {
    using boost::serialization::make_nvp;
    ar & make_nvp("coord_sys", boost::serialization::base_object<CCoordSys>(*this));
    ar & make_nvp("name",     name_);
    ar & make_nvp("station",  station_);
    ar & make_nvp("first",    first_);
    ar & make_nvp("second",   second_);
    ar & make_nvp("third",    third_);
    ar & make_nvp("type",     type_);
    ar & make_nvp("param_i",  param_i_);
    ar & make_nvp("param_j",  param_j_);
    ar & make_nvp("param_k",  param_k_);
  }
};

